Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[exporter/prometheusremotewrite] feat: prom rw exporter add support for rw2 #35888

Open
wants to merge 96 commits into
base: main
Choose a base branch
from

Conversation

jmichalek132
Copy link
Contributor

@jmichalek132 jmichalek132 commented Oct 20, 2024

Description

Draft PR for adding rw2 support in the prometheus remote write exporter.
Very much a draft, not full implementation of the spec with a lot of code duplication and no tests WIP.

TODO:

  • changelog entry
  • feature flag on top of config options
  • rip out batching for now
  • enum instead of bool for RW2
  • update exporter readme
  • Validate supported enum value set
  • Check for TODOs
  • unit tests
  • going over the spec and making changes to be rw2 compliant -> follow up PR
  • try to reduce duplicate code

Link to tracking issue #33661

Fixes

Testing

Documentation

@jpkrohling jpkrohling changed the title feat: prom rw exporter add support for rw2 [exporter/prometheusremotewrite] feat: prom rw exporter add support for rw2 Nov 27, 2024
@dashpole
Copy link
Contributor

dashpole commented Dec 2, 2024

needs rebase :/

req.Header.Set("Content-Type", "application/x-protobuf;proto=io.prometheus.write.v2.Request")
req.Header.Set("X-Prometheus-Remote-Write-Version", "2.0.0")
default:
return errors.New("proto message validated earlier")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: if we do err check vs panic here, let's do it properly (it's true a later version of this code could by accident remove pre-validation.

Suggested change
return errors.New("proto message validated earlier")
return fmt.Errorf("unsupported remote-write protobuf message: %v (should be validated earlier)", prwe.RemoteWriteProtoMsg)

ok := proto.Unmarshal(dest, wr)
require.NoError(t, ok)
assert.Len(t, wr.Timeseries, expected)
// TODO check labels
Copy link

@bwplotka bwplotka Dec 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be a GH issue about it to not forget? Or todo now?

buf.protobuf.Reset()
defer bufferPool.Put(buf)

// Uses proto.Marshal to convert the WriteRequest into bytes array
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comments repeats in multiple places. Is it really useful?


// Uses proto.Marshal to convert the WriteRequest into bytes array.
if errMarshal := buf.protobuf.Marshal(request); errMarshal != nil {
errs = multierr.Append(errs, consumererror.NewPermanent(errMarshal))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto: risk of race here (errs shared by multiple goroutines and not locked)

}

// TODO implement batching
// TODO how do we handle symbolsTable with batching?
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have to build separate symbol tables or use a bigger single one, whatever is cheaper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants